//
//  CRootCtrlManager.h
//  HCHK_iphone
//
//  Created by yilong zhang on 11-12-7.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <stdlib.h>
#import "CMainPageCtrl.h"
#import "CSearchPageCtrl.h"
#import "CUploadPageCtrl.h"
#import "CFavoriteCtrlPage.h"
#import "CUserPageCtrl.h"
#import "CUploadView.h"
#import "CLocator.h"
#import "CImageSelector.h"
#import "UITabBarEx.h"
#import "CCitySelector.h"


typedef enum {Normal, NotLocal, NotNet}AppStartType;

@class CShareView;
@class CComEditView;

@interface CRootCtrlManager : UIViewController <TabBarExDelegate, UIAlertViewDelegate, CitySelectorProtocal>

//tabbar
@property (nonatomic, assign)           UITabBarEx              *m_TabBar;

@property (nonatomic, assign) IBOutlet  UIView                  *m_OverView;
@property (nonatomic, assign) IBOutlet  UIImageView             *m_CurPage;
@property (nonatomic, assign) IBOutlet  UIImageView             *m_NextPage;
@property (nonatomic, assign)           int                     m_nImageNo;

//@property (nonatomic, assign) IBOutlet  UIView                  *m_TabView;
//@property (nonatomic, assign) IBOutlet  UIView                  *m_TopBar;

@property (nonatomic, assign) IBOutlet  UIView                  *m_LoadView;
@property (nonatomic, assign) IBOutlet  UIView                  *m_LoadBg;
@property (nonatomic, assign) IBOutlet  UILabel                 *m_LoadTitle;
@property (nonatomic, assign) IBOutlet  UIActivityIndicatorView *m_LoadIndicator;

@property (nonatomic, assign) IBOutlet  UIImageView             *m_TbFocus;
@property (nonatomic, assign) IBOutlet  UIButton                *m_PreViewBtn;
@property (nonatomic, assign) IBOutlet  UIButton                *m_UploadBtn;
@property (nonatomic, assign) IBOutlet  UIButton                *m_FavoriteBtn;

@property (nonatomic, assign)           BOOL                    m_bIsActive;

@property (nonatomic, assign) NSMutableArray                    *m_Ctrls;

//share
@property (nonatomic, assign) CShareView    *m_Share;

//commentary
@property (nonatomic, assign) CComEditView  *m_ComEdit;

//imageselector
@property (nonatomic, assign) CImageSelector*m_ImageSelector;

//alterview
@property (nonatomic, assign) UIAlertView   *m_AlterView;
@property (nonatomic, assign) BOOL          m_bIsAlterShow;

//new
@property (nonatomic, assign) AppStartType  m_enAppLaunchType;
//cityselector
@property (nonatomic, assign) CCitySelector *m_CitySel;

//cover
@property (nonatomic, assign) UIImageView   *m_Cover;
@property (nonatomic, assign) UIImageView   *m_Animas;
@property (nonatomic, assign) BOOL          m_bIsOver;


+(CRootCtrlManager*)DefaultRootCtrl;
+(void)DestroyRootCtrl;

-(IBAction)OnButtonDown:(UIButton*)sender;
-(void)SortSubviews:(UIView*)view;
-(void)BringCtrlToFront:(int)index;
-(void)LoadDatas;
-(void)DidFinishLoad;

-(void)ShowLoadView:(CGFloat)alpha Title:(NSString*)title;
-(void)SetLoadViewTitle:(NSString*)title;
-(void)HiddenLoadView;

-(void)ShowSubView:(UIView*)subview;
-(void)HiddenSubView:(UIView*)subview;
-(void)DidSubViewShowed;
-(void)DidSubViewHidden;

//share
-(void)ShowShareView;
-(void)DidShareShow;
-(void)HiddenShareView;
-(void)DidShareHidden;

//commentary
-(void)ShowComEditView;
-(void)ComEditViewShown;
-(void)HiddenComEditView;
-(void)ComEditViewHidden;

//imageseletor
-(void)ShowImageSelector;
-(void)HiddenImageSelector;
-(void)DidImageSelectorShown;
-(void)DidImageSelectorHidden;

//location
-(void)LocationReponse:(NSNotification*)notification;

//network
-(void)NetWorkRun:(NSNotification*)notification;

//focusview
-(void)ShowCurView:(int)index;

//overlayer
-(void)RemoveCover;
-(void)DidRemoveCover;
-(void)ChangeCover;
-(void)DidChangeCover;
-(void)AnimationOver;

//show alterview
-(void)ShowAlterView:(NSString*)mes State:(int)state;

//city
-(void)ShowCitySelView;

//self
-(void)DidAppBecameActive:(NSNotification*)notification;
-(void)DidAppEnterBackground:(NSNotification*)notification;

-(void)SetUserData:(BOOL)isrun;

//mainpage
-(void)FreshMainPage;

@end
